GOCMD = go
BUILD_ENV := CGO_ENABLED=1
BUILD=`date +%FT%T%z`
LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION} -X main.Build=${BUILD}"

TARGET := ../sbin/martrix

all: clean build

clean:
	rm -rf ${TARGET}

run:
	$(GOCMD) run main.go

build:
	${BUILD_ENV} GOOS=darwin ${GOCMD} build ${LDFLAGS} -o ${TARGET}
build-linux:
	${BUILD_ENV} GOARCH=amd64 GOOS=linux ${GOCMD} build ${LDFLAGS} -o ${TARGET}
build-osx:
	${BUILD_ENV} GOOS=darwin ${GOCMD} build ${LDFLAGS} -o ${TARGET}
